module.exports = {
  env: {
    browser: true,
    es6: true,
    node: true,
  },
  extends: [
    "plugin:react/recommended",
    "standard-with-typescript",
    "plugin:prettier/recommended",
    "eslint:recommended",
    "plugin:@typescript-eslint/recommended",
    "plugin:react/jsx-runtime",
    "plugin:jsx-a11y/recommended",
  ],
  settings: {
    react: {
      version: "detect",
    },
  },
  overrides: [],
  parserOptions: {
    ecmaVersion: "latest",
    sourceType: "module",
    project: ["tsconfig.json"],
    ecmaFeatures: {
      jsx: true,
    },
  },
  ignorePatterns: ["*.cjs", "*.config.ts", "dist"],
  parser: "@typescript-eslint/parser",
  root: true,
  plugins: ["react", "prettier", "@typescript-eslint", "jsx-a11y"],
  rules: {
    "@typescript-eslint/ban-types": [
      2,
      {
        types: {
          object: {
            message: "使用 `Record<string, unknown>` 代替 `object`",
            fixWith: "Record<string, unknown>",
          },
        },
      },
    ],
    "@typescript-eslint/no-explicit-any": 1,
    "@typescript-eslint/triple-slash-reference": "off",
    "@typescript-eslint/explicit-module-boundary-types": 2,
    "prettier/prettier": "error",
    "arrow-body-style": "off",
    "prefer-arrow-callback": "off",
    "react/prop-types": "off",
    "no-console": ["warn", { allow: ["warn", "error"] }],
    "import/prefer-default-export": "off",
    "jsx-a11y/no-onchange": "off",
    "jsx-a11y/no-autofocus": "off",
    "jsx-a11y/anchor-is-valid": [
      "error",
      {
        components: ["Link"],
        specialLink: ["to"],
      },
    ],
    "jsx-a11y/label-has-associated-control": [
      "error",
      {
        labelComponents: ["CustomLabel"],
        labelAttributes: ["label"],
        controlComponents: ["CustomInput"],
        assert: "either",
        depth: 3,
      },
    ],
  },
};
